#ifndef QAUGMENTEDREALITYCAMERAMODEL_H
#define QAUGMENTEDREALITYCAMERAMODEL_H

#include <QAbstractListModel>
#include <QDeclarativeListProperty>

#include "qdll_global.h"
#include "qaugmentedrealitycameraitem.h"

class QDLLSHARED_EXPORT QAugmentedRealityCameraModel : public QAbstractListModel
{
    Q_OBJECT
    Q_CLASSINFO("Author", "Sebastiano Galazzo")
    Q_CLASSINFO("Email", "sebastiano.galazzo@gmail.com")
    Q_PROPERTY(QDeclarativeListProperty<QAugmentedRealityCameraItem> pins READ pins)

public:
  explicit QAugmentedRealityCameraModel(QObject* parent = 0);
  ~QAugmentedRealityCameraModel();

  int rowCount(const QModelIndex &parent = QModelIndex()) const;
  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
  QHash<int, QByteArray> roleNames() const;

  Q_INVOKABLE void append(QVariantMap item);
  void appendRow(QAugmentedRealityCameraItem* item);
  void appendRows(const QList<QAugmentedRealityCameraItem*> &items);
  void insertRow(int row, QAugmentedRealityCameraItem* item);
  bool removeRow(int row, const QModelIndex &parent = QModelIndex());
  bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
  QAugmentedRealityCameraItem* at(int row);
  QAugmentedRealityCameraItem* takeRow(int row);
  QAugmentedRealityCameraItem* find(const QString &id) const;
  QModelIndex indexFromItem( const QAugmentedRealityCameraItem* item) const;
  void clear();

  QDeclarativeListProperty<QAugmentedRealityCameraItem> pins();

private slots:
  void handleItemChange();

private:
  QAugmentedRealityCameraItem* m_prototype;
  QList<QAugmentedRealityCameraItem*> m_list;

};
#endif // QAUGMENTEDREALITYCAMERAMODEL_H
